using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using kxcxw.Data.Entities;

namespace kxcxw.Data.Mapping
{
	public class AdApplyMap : EntityTypeConfiguration<AdApply>
	{
        public AdApplyMap()
		{
			// Primary Key
            this.HasKey(t => t.AdId);

			// Properties
            this.Property(t => t.AdId)
				.IsRequired()
				.HasMaxLength(36);
				
			this.Property(t => t.AltText)
				.IsRequired()
				.HasMaxLength(100);

            this.Property(t => t.AdBlockId)
                .IsRequired()
                .HasMaxLength(5);
				
			this.Property(t => t.ImgName)
				.IsRequired()
				.HasMaxLength(150);

            this.Property(t => t.Href)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.EffectiveDays)
                .IsRequired();
				
			// Table & Column Mappings
            this.ToTable("AdApply");
            this.Property(t => t.AdId).HasColumnName("AdId");
            this.Property(t => t.AdBlockId).HasColumnName("AdBlockId");
            this.Property(t => t.AltText).HasColumnName("AltText");
            this.Property(t => t.ImgName).HasColumnName("ImgName");
            this.Property(t => t.Href).HasColumnName("Href");
            this.Property(t => t.EffectiveDays).HasColumnName("EffectiveDays");
            this.Property(t => t.UserID).HasColumnName("UserID");
            this.Property(t => t.ApplyerName).HasColumnName("ApplyerName");
            this.Property(t => t.Phone).HasColumnName("Phone");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.ApprovalDate).HasColumnName("ApprovalDate");
            this.Property(t => t.ApprovalUser).HasColumnName("ApprovalUser");
            this.Property(t => t.CreateDate).HasColumnName("CreateDate");

            // Relationships
		}
	}
}

